<!doctype html>
<html class="no-js">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>{$system_name}</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileColor" content="#0e90d2">
    <!-- SEO: If your mobile URL is different from the desktop URL, add a canonical link to the desktop page https://developers.google.com/webmasters/smartphone-sites/feature-phones -->
    <!--
  <link rel="canonical" href="http://www.example.com/">
  -->
    <link rel="stylesheet" href="__PUBLIC__/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="__PUBLIC__/assets/css/app.css">
    <!--<link rel="stylesheet" href="__PUBLIC__/assets/css/index.css">-->
    <!--必要样式-->
    <style>
    </style>
</head>

<body>
<header data-am-widget="header" class="am-header am-header-default">
    <div class="am-header-left am-header-nav">
        <a href="__APP__/Home/Lottery/" class="">
            <img src="__PUBLIC__/assets/i/left.png" alt="" style="margin: 5px">
        </a>
    </div>

    <h1 class="am-header-title">
        <a href="#title-link" class="">
            领奖记录
        </a>
    </h1>

</header>
<style>
    .box-header {
        line-height: 40px;
        color: #333;
        font-size: 15px;

    }

    .box-item {
        line-height: 34px;
        color: #000;
        font-size: 12px;
        border-bottom: 1px dashed #999;
    }
</style>
<div class="box">
    <div class="box-header am-g">
        <div class="am-u-sm-5 am-text-left">
            抽奖时间
        </div>
        <div class="am-u-sm-3 am-padding-0">
            中奖奖品
        </div>
        <div class="am-u-sm-4 am-text-right">
            发放状态
        </div>
    </div>
    <div id="data_list">

    </div>
</div>


<!--[if (gte IE 9)|!(IE)]><!-->
<script src="__PUBLIC__/assets/js/jquery.min.js"></script>
<script src="__PUBLIC__/assets/js/angular.min.js"></script>
<script src="__PUBLIC__/assets/js/amazeui.min.js"></script>
<script type="text/javascript">
    var page=1; //当前页的页码
    var allpage =1; //总页码，会从后台获取
    $(function () {
        getLotteryLogListByPage(1);
    });

    function scrollFn(){
        allpage = $('#totalpage').val();
        //真实内容的高度
        var pageHeight = Math.max(document.body.scrollHeight,document.body.offsetHeight);
        //视窗的高度
        var viewportHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0;
        //隐藏的高度
        var scrollHeight = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
        if(pageHeight - viewportHeight - scrollHeight < 20){  //如果满足触发条件，执行
            if(page <= allpage) {
                getLotteryLogList();
            }
        }
    }
    $(window).bind("scroll",scrollFn);  //绑定滚动事件
    function getLotteryLogListByPage(pagenum) {
        //提交form
        $('#race_pagenum_hidden').val(pagenum);
        getLotteryLogList();
    }
    function getLotteryLogList() {
        $.ajax({
            type: "POST",
            url: "__URL__/ajaxLotteryLogList",
            async: false,
            data: {
                pagenum: page,
                type : 1
            },
//            dataType: "json",
            success: function (data) {
//                console.info(data);
                page++;  //页数加1
                console.info('nextPage:' + page);
                $('#data_list').append(data);
            },
            error: function (data) {
                console.info(data);
            }
        });
    }
</script>
</body>
</html>

